home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 676-700 / 683 / printfiles / deutsch / rexx / prf.rexx < prev    next >
OS/2 REXX Batch file  |  1995-03-18  |  2KB  |  75 lines

  1. /* printfiles Arexx Macro                              */
  2. /* © 1992 by K. Klingbeil                              */
  3. /* fügt Dateinamen mittels pattern-matching in die     */
  4. /* Druckliste ein                                      */
  5. /* Befehl   : rx prf [Einfügepattern] -r[Löschpattern] */
  6. /*                   -f[ArexxMakro]                    */
  7. /* Beispiel : rx prf  #?.c #?.h -rtest#?.c  -rtest.h   */
  8. /*            fügt alle Dateien im aktuellen           */
  9. /*            Verzeichnis, die auf .c oder .h enden in */
  10. /*            die Druckliste und löscht alle dateien   */
  11. /*            die test im Namen mit der Endung .c      */
  12. /*            und die Datei test.h                     */
  13. /* ArexxMakro ist der Name eines Arexx-Programms, das  */
  14. /* dabei ausgeführt werden soll (z.B. für Voreinstell- */
  15. /* ungen)                                              */
  16. /* Anmerkung: von Printfiles generierte Arexx-Programme*/
  17. /* sollten das erste Argument sein, da sie zu Beginn   */
  18. /* einen reset-Befehl beinhalten                       */
  19. /* Beispiel für die richtige Reihenfolge:              */
  20. /* rx prf -fPrintfiles.makro #?.c -rtest.c             */
  21.  
  22. options results
  23. if ~show(ports,'PRINTFILES')then do
  24.     address command 'printfiles'
  25. end
  26. if ~(show(ports,'PRINTFILES')) then return 5
  27.  
  28. parse arg CmdLine
  29. p = words(CmdLine)
  30.  
  31. do i = 1 to p
  32.    pattern = word(CmdLine,i)
  33.    if left(pattern,2) == '-r' then removefile(substr(pattern,3))
  34.     else
  35.      if left(pattern,2) == '-f' then rxfile(substr(pattern,3))
  36.       else insertfile(pattern)
  37. end
  38. exit
  39.  
  40. rxfile: procedure
  41. parse arg template
  42. cmd =  'rx ' template
  43. address command cmd
  44. return 1
  45.  
  46. removefile: procedure
  47. parse arg template
  48. cmd =  'list >pipe:prf' template 'quick'
  49. address command cmd
  50. open('p','pipe:prf','r')
  51.  do while ~eof('p')
  52.   file = readln('p')
  53.   a = subword(file,1,1)
  54.   b = subword(file,2,1)
  55.   if a ~== '' & b == '' then address printfiles remfile a
  56.  end
  57. close('p')
  58.  
  59. return 1
  60.  
  61. insertfile: procedure
  62. parse arg template
  63. cmd =  'list >pipe:prf' template 'quick'
  64. address command cmd
  65. open('p','pipe:prf','read')
  66.  do while ~eof('p')
  67.   file = readln('p')
  68.   a = subword(file,1,1)
  69.   b = subword(file,2,1)
  70.   if a ~== '' & b == '' then address printfiles insfile a
  71.  end
  72. close('p')
  73. return  1
  74.  
  75.